/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/{{apis}}/mapping/{{apiDtos@DEFAULT}}Mapping.java.hbs
 */
package cn.ibizlab.core.system.mapping;

import cn.ibizlab.core.system.domain.SysComponent;
import cn.ibizlab.core.system.domain.SysCustomResource;
import org.mapstruct.*;

import java.util.List;

@Mapper(componentModel = "spring", uses = {},
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface ResourceMapping {

    @Mappings({
            @Mapping(source ="type", target = "componentType"),
            @Mapping(target = "codeName", constant = "CUSTOM_RESOURCE"),
    })
    SysComponent customResource2Component(SysCustomResource customResource);

    @Mappings({
            @Mapping(source ="type", target = "componentType"),
            @Mapping(target = "codeName", constant = "CUSTOM_RESOURCE"),
    })
    List<SysComponent> customResource2Component(List<SysCustomResource> customResources);

    @Mappings({
            @Mapping(source ="componentType", target = "type")
    })
    SysCustomResource Component2CustomResource(SysComponent component);

    @Mappings({
            @Mapping(source ="componentType", target = "type")
    })
    List<SysCustomResource> Component2CustomResource(List<SysComponent> components);

}
